home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1997 July: Mac OS SDK / Dev.CD Jul 97 SDK1.toast / Development Kits (Disc 1) / Interfaces&Libraries / Interfaces / AIncludes / Menus.a < prev    next >
Encoding:
Text File  |  1996-01-24  |  11.4 KB  |  573 lines  |  [TEXT/MPS ]

  1. ;
  2. ;    File:        Menus.a
  3. ;
  4. ;    Contains:    Menu Manager Interfaces.
  5. ;
  6. ;    Version:    Technology:    System 7.5
  7. ;                Package:    Universal Interfaces 2.2 in “MPW” on ETO #20
  8. ;
  9. ;    Copyright:    © 1984-1995 by Apple Computer, Inc.
  10. ;                All rights reserved.
  11. ;
  12. ;    Bugs?:        If you find a problem with this file, use the Apple Bug Reporter
  13. ;                stack.  Include the file and version information (from above)
  14. ;                in the problem description and send to:
  15. ;                    Internet:    apple.bugs@applelink.apple.com
  16. ;                    AppleLink:    APPLE.BUGS
  17. ;
  18. ;
  19.  
  20.     IF &TYPE('__MENUS__') = 'UNDEFINED' THEN
  21. __MENUS__ SET 1
  22.  
  23.  
  24.     IF &TYPE('__MEMORY__') = 'UNDEFINED' THEN
  25.     include 'Memory.a'
  26.     ENDIF
  27. ;        include 'Types.a'                                            ;
  28. ;            include 'ConditionalMacros.a'                            ;
  29. ;        include 'MixedMode.a'                                        ;
  30.  
  31.     IF &TYPE('__QUICKDRAW__') = 'UNDEFINED' THEN
  32.     include 'Quickdraw.a'
  33.     ENDIF
  34. ;        include 'QuickdrawText.a'                                    ;
  35.  
  36. noMark                            EQU        0                    ;mark symbol for MarkItem
  37. ; menu defProc messages 
  38. mDrawMsg                        EQU        0
  39. mChooseMsg                        EQU        1
  40. mSizeMsg                        EQU        2
  41. mDrawItemMsg                    EQU        4
  42. mCalcItemMsg                    EQU        5
  43. textMenuProc                    EQU        0
  44. hMenuCmd                        EQU        27                    ;itemCmd == 0x001B ==> hierarchical menu
  45. hierMenu                        EQU        -1                    ;a hierarchical menu - for InsertMenu call
  46. mPopUpMsg                        EQU        3                    ;menu defProc messages - place yourself
  47. mctAllItems                        EQU        -98                    ;search for all Items for the given ID
  48. mctLastIDIndic                    EQU        -99                    ;last color table entry has this in ID field
  49.  
  50.     IF &TYPE('STRICT_MENUS') = 'UNDEFINED' THEN
  51.     STRICT_MENUS: SET 0
  52.     ENDIF
  53.     IF STRICT_MENUS  THEN
  54. ; typedef MenuRef             MenuHandle
  55.     ELSE
  56. MenuInfo                 RECORD    0
  57. menuID                     ds.w   1        ; offset: $0 (0)
  58. menuWidth                 ds.w   1        ; offset: $2 (2)
  59. menuHeight                 ds.w   1        ; offset: $4 (4)
  60. menuProc                 ds.l   1        ; offset: $6 (6)
  61. enableFlags                 ds.l   1        ; offset: $A (10)
  62. menuData                 ds.l   64        ; offset: $E (14)
  63. sizeof                     EQU *            ; size:   $10E (270)
  64.                         ENDR
  65.  
  66. ; typedef struct MenuInfo     MenuInfo, *MenuPtr, **MenuHandle
  67. ; typedef MenuHandle         MenuRef
  68.     ENDIF
  69. MCEntry                 RECORD    0
  70. mctID                     ds.w   1        ; offset: $0 (0)        ;menu ID.  ID = 0 is the menu bar
  71. mctItem                     ds.w   1        ; offset: $2 (2)        ;menu Item. Item = 0 is a title
  72. mctRGB1                     ds     RGBColor ; offset: $4 (4)        ;usage depends on ID and Item
  73. mctRGB2                     ds     RGBColor ; offset: $A (10)        ;usage depends on ID and Item
  74. mctRGB3                     ds     RGBColor ; offset: $10 (16)        ;usage depends on ID and Item
  75. mctRGB4                     ds     RGBColor ; offset: $16 (22)        ;usage depends on ID and Item
  76. mctReserved                 ds.w   1        ; offset: $1C (28)        ;reserved for internal use
  77. sizeof                     EQU *            ; size:   $1E (30)
  78.                         ENDR
  79.  
  80. ; typedef struct MCEntry     MCEntry
  81. ; typedef MCEntry             *MCEntryPtr
  82. ; typedef MCEntry             MCTable[1], *MCTablePtr, **MCTableHandle
  83. MenuCRsrc                 RECORD    0
  84. numEntries                 ds.w   1        ; offset: $0 (0)        ;number of entries
  85. mcEntryRecs                 ds.w   15        ; offset: $2 (2)        ;ARRAY [1..numEntries] of MCEntry
  86. sizeof                     EQU *            ; size:   $20 (32)
  87.                         ENDR
  88.  
  89. ; typedef struct MenuCRsrc     MenuCRsrc
  90. ; typedef MenuCRsrc         *MenuCRsrcPtr, **MenuCRsrcHandle
  91. ;
  92. ; pascal short GetMBarHeight(void)
  93. ;
  94.     IF ¬ GENERATINGCFM THEN
  95.         Macro
  96.         _GetMBarHeight         &dest=(sp)
  97.         move.w               $0BAA,&dest
  98.         EndM
  99.     ELSE
  100.         IMPORT_CFM_FUNCTION    GetMBarHeight
  101.     ENDIF
  102.  
  103. ;
  104. ; pascal void InitMenus(void)
  105. ;
  106.     IF ¬ GENERATINGCFM THEN
  107.         _InitMenus:    OPWORD    $A930
  108.     ELSE
  109.         IMPORT_CFM_FUNCTION    InitMenus
  110.     ENDIF
  111.  
  112. ;
  113. ; pascal MenuRef NewMenu(short menuID, ConstStr255Param menuTitle)
  114. ;
  115.     IF ¬ GENERATINGCFM THEN
  116.         _NewMenu:    OPWORD    $A931
  117.     ELSE
  118.         IMPORT_CFM_FUNCTION    NewMenu
  119.     ENDIF
  120.  
  121. ;
  122. ; pascal MenuRef GetMenu(short resourceID)
  123. ;
  124.     IF ¬ GENERATINGCFM THEN
  125.         _GetMenu:    OPWORD    $A9BF
  126.     ELSE
  127.         IMPORT_CFM_FUNCTION    GetMenu
  128.     ENDIF
  129.  
  130. ;
  131. ; pascal void DisposeMenu(MenuRef theMenu)
  132. ;
  133.     IF ¬ GENERATINGCFM THEN
  134.         _DisposeMenu:    OPWORD    $A932
  135.     ELSE
  136.         IMPORT_CFM_FUNCTION    DisposeMenu
  137.     ENDIF
  138.  
  139. ;
  140. ; pascal void AppendMenu(MenuRef menu, ConstStr255Param data)
  141. ;
  142.     IF ¬ GENERATINGCFM THEN
  143.         _AppendMenu:    OPWORD    $A933
  144.     ELSE
  145.         IMPORT_CFM_FUNCTION    AppendMenu
  146.     ENDIF
  147.  
  148. ;
  149. ; pascal void AppendResMenu(MenuRef theMenu, ResType theType)
  150. ;
  151.     IF ¬ GENERATINGCFM THEN
  152.         _AppendResMenu:    OPWORD    $A94D
  153.     ELSE
  154.         IMPORT_CFM_FUNCTION    AppendResMenu
  155.     ENDIF
  156.  
  157. ;
  158. ; pascal void InsertResMenu(MenuRef theMenu, ResType theType, short afterItem)
  159. ;
  160.     IF ¬ GENERATINGCFM THEN
  161.         _InsertResMenu:    OPWORD    $A951
  162.     ELSE
  163.         IMPORT_CFM_FUNCTION    InsertResMenu
  164.     ENDIF
  165.  
  166. ;
  167. ; pascal void InsertMenu(MenuRef theMenu, short beforeID)
  168. ;
  169.     IF ¬ GENERATINGCFM THEN
  170.         _InsertMenu:    OPWORD    $A935
  171.     ELSE
  172.         IMPORT_CFM_FUNCTION    InsertMenu
  173.     ENDIF
  174.  
  175. ;
  176. ; pascal void DrawMenuBar(void)
  177. ;
  178.     IF ¬ GENERATINGCFM THEN
  179.         _DrawMenuBar:    OPWORD    $A937
  180.     ELSE
  181.         IMPORT_CFM_FUNCTION    DrawMenuBar
  182.     ENDIF
  183.  
  184. ;
  185. ; pascal void InvalMenuBar(void)
  186. ;
  187.     IF ¬ GENERATINGCFM THEN
  188.         _InvalMenuBar:    OPWORD    $A81D
  189.     ELSE
  190.         IMPORT_CFM_FUNCTION    InvalMenuBar
  191.     ENDIF
  192.  
  193. ;
  194. ; pascal void DeleteMenu(short menuID)
  195. ;
  196.     IF ¬ GENERATINGCFM THEN
  197.         _DeleteMenu:    OPWORD    $A936
  198.     ELSE
  199.         IMPORT_CFM_FUNCTION    DeleteMenu
  200.     ENDIF
  201.  
  202. ;
  203. ; pascal void ClearMenuBar(void)
  204. ;
  205.     IF ¬ GENERATINGCFM THEN
  206.         _ClearMenuBar:    OPWORD    $A934
  207.     ELSE
  208.         IMPORT_CFM_FUNCTION    ClearMenuBar
  209.     ENDIF
  210.  
  211. ;
  212. ; pascal Handle GetNewMBar(short menuBarID)
  213. ;
  214.     IF ¬ GENERATINGCFM THEN
  215.         _GetNewMBar:    OPWORD    $A9C0
  216.     ELSE
  217.         IMPORT_CFM_FUNCTION    GetNewMBar
  218.     ENDIF
  219.  
  220. ;
  221. ; pascal Handle GetMenuBar(void)
  222. ;
  223.     IF ¬ GENERATINGCFM THEN
  224.         _GetMenuBar:    OPWORD    $A93B
  225.     ELSE
  226.         IMPORT_CFM_FUNCTION    GetMenuBar
  227.     ENDIF
  228.  
  229. ;
  230. ; pascal void SetMenuBar(Handle menuList)
  231. ;
  232.     IF ¬ GENERATINGCFM THEN
  233.         _SetMenuBar:    OPWORD    $A93C
  234.     ELSE
  235.         IMPORT_CFM_FUNCTION    SetMenuBar
  236.     ENDIF
  237.  
  238. ;
  239. ; pascal void InsertMenuItem(MenuRef theMenu, ConstStr255Param itemString, short afterItem)
  240. ;
  241.     IF ¬ GENERATINGCFM THEN
  242.         _InsertMenuItem:    OPWORD    $A826
  243.     ELSE
  244.         IMPORT_CFM_FUNCTION    InsertMenuItem
  245.     ENDIF
  246.  
  247. ;
  248. ; pascal void DeleteMenuItem(MenuRef theMenu, short item)
  249. ;
  250.     IF ¬ GENERATINGCFM THEN
  251.         _DeleteMenuItem:    OPWORD    $A952
  252.     ELSE
  253.         IMPORT_CFM_FUNCTION    DeleteMenuItem
  254.     ENDIF
  255.  
  256. ;
  257. ; pascal long MenuKey(asciichar ch)
  258. ;
  259.     IF ¬ GENERATINGCFM THEN
  260.         _MenuKey:    OPWORD    $A93E
  261.     ELSE
  262.         IMPORT_CFM_FUNCTION    MenuKey
  263.     ENDIF
  264.  
  265. ;
  266. ; pascal void HiliteMenu(short menuID)
  267. ;
  268.     IF ¬ GENERATINGCFM THEN
  269.         _HiliteMenu:    OPWORD    $A938
  270.     ELSE
  271.         IMPORT_CFM_FUNCTION    HiliteMenu
  272.     ENDIF
  273.  
  274. ;
  275. ; pascal void SetMenuItemText(MenuRef theMenu, short item, ConstStr255Param itemString)
  276. ;
  277.     IF ¬ GENERATINGCFM THEN
  278.         _SetMenuItemText:    OPWORD    $A947
  279.     ELSE
  280.         IMPORT_CFM_FUNCTION    SetMenuItemText
  281.     ENDIF
  282.  
  283. ;
  284. ; pascal void GetMenuItemText(MenuRef theMenu, short item, Str255 itemString)
  285. ;
  286.     IF ¬ GENERATINGCFM THEN
  287.         _GetMenuItemText:    OPWORD    $A946
  288.     ELSE
  289.         IMPORT_CFM_FUNCTION    GetMenuItemText
  290.     ENDIF
  291.  
  292. ;
  293. ; pascal void DisableItem(MenuRef theMenu, short item)
  294. ;
  295.     IF ¬ GENERATINGCFM THEN
  296.         _DisableItem:    OPWORD    $A93A
  297.     ELSE
  298.         IMPORT_CFM_FUNCTION    DisableItem
  299.     ENDIF
  300.  
  301. ;
  302. ; pascal void EnableItem(MenuRef theMenu, short item)
  303. ;
  304.     IF ¬ GENERATINGCFM THEN
  305.         _EnableItem:    OPWORD    $A939
  306.     ELSE
  307.         IMPORT_CFM_FUNCTION    EnableItem
  308.     ENDIF
  309.  
  310. ;
  311. ; pascal void CheckItem(MenuRef theMenu, short item, Boolean checked)
  312. ;
  313.     IF ¬ GENERATINGCFM THEN
  314.         _CheckItem:    OPWORD    $A945
  315.     ELSE
  316.         IMPORT_CFM_FUNCTION    CheckItem
  317.     ENDIF
  318.  
  319. ;
  320. ; pascal void SetItemMark(MenuRef theMenu, short item, asciichar markChar)
  321. ;
  322.     IF ¬ GENERATINGCFM THEN
  323.         _SetItemMark:    OPWORD    $A944
  324.     ELSE
  325.         IMPORT_CFM_FUNCTION    SetItemMark
  326.     ENDIF
  327.  
  328. ;
  329. ; pascal void GetItemMark(MenuRef theMenu, short item, asciichar *markChar)
  330. ;
  331.     IF ¬ GENERATINGCFM THEN
  332.         _GetItemMark:    OPWORD    $A943
  333.     ELSE
  334.         IMPORT_CFM_FUNCTION    GetItemMark
  335.     ENDIF
  336.  
  337. ;
  338. ; pascal void SetItemIcon(MenuRef theMenu, short item, short iconIndex)
  339. ;
  340.     IF ¬ GENERATINGCFM THEN
  341.         _SetItemIcon:    OPWORD    $A940
  342.     ELSE
  343.         IMPORT_CFM_FUNCTION    SetItemIcon
  344.     ENDIF
  345.  
  346. ;
  347. ; pascal void GetItemIcon(MenuRef theMenu, short item, short *iconIndex)
  348. ;
  349.     IF ¬ GENERATINGCFM THEN
  350.         _GetItemIcon:    OPWORD    $A93F
  351.     ELSE
  352.         IMPORT_CFM_FUNCTION    GetItemIcon
  353.     ENDIF
  354.  
  355. ;
  356. ; pascal void SetItemStyle(MenuRef theMenu, short item, Style chStyle)
  357. ;
  358.     IF ¬ GENERATINGCFM THEN
  359.         _SetItemStyle:    OPWORD    $A942
  360.     ELSE
  361.         IMPORT_CFM_FUNCTION    SetItemStyle
  362.     ENDIF
  363.  
  364. ;
  365. ; pascal void GetItemStyle(MenuRef theMenu, short item, Style *chStyle)
  366. ;
  367.     IF ¬ GENERATINGCFM THEN
  368.         _GetItemStyle:    OPWORD    $A941
  369.     ELSE
  370.         IMPORT_CFM_FUNCTION    GetItemStyle
  371.     ENDIF
  372.  
  373. ;
  374. ; pascal void CalcMenuSize(MenuRef theMenu)
  375. ;
  376.     IF ¬ GENERATINGCFM THEN
  377.         _CalcMenuSize:    OPWORD    $A948
  378.     ELSE
  379.         IMPORT_CFM_FUNCTION    CalcMenuSize
  380.     ENDIF
  381.  
  382. ;
  383. ; pascal short CountMItems(MenuRef theMenu)
  384. ;
  385.     IF ¬ GENERATINGCFM THEN
  386.         _CountMItems:    OPWORD    $A950
  387.     ELSE
  388.         IMPORT_CFM_FUNCTION    CountMItems
  389.     ENDIF
  390.  
  391. ;
  392. ; pascal MenuRef GetMenuHandle(short menuID)
  393. ;
  394.     IF ¬ GENERATINGCFM THEN
  395.         _GetMenuHandle:    OPWORD    $A949
  396.     ELSE
  397.         IMPORT_CFM_FUNCTION    GetMenuHandle
  398.     ENDIF
  399.  
  400. ;
  401. ; pascal void FlashMenuBar(short menuID)
  402. ;
  403.     IF ¬ GENERATINGCFM THEN
  404.         _FlashMenuBar:    OPWORD    $A94C
  405.     ELSE
  406.         IMPORT_CFM_FUNCTION    FlashMenuBar
  407.     ENDIF
  408.  
  409. ;
  410. ; pascal void SetMenuFlash(short count)
  411. ;
  412.     IF ¬ GENERATINGCFM THEN
  413.         _SetMenuFlash:    OPWORD    $A94A
  414.     ELSE
  415.         IMPORT_CFM_FUNCTION    SetMenuFlash
  416.     ENDIF
  417.  
  418. ;
  419. ; pascal long MenuSelect(Point startPt)
  420. ;
  421.     IF ¬ GENERATINGCFM THEN
  422.         _MenuSelect:    OPWORD    $A93D
  423.     ELSE
  424.         IMPORT_CFM_FUNCTION    MenuSelect
  425.     ENDIF
  426.  
  427. ;
  428. ; pascal void InitProcMenu(short resID)
  429. ;
  430.     IF ¬ GENERATINGCFM THEN
  431.         _InitProcMenu:    OPWORD    $A808
  432.     ELSE
  433.         IMPORT_CFM_FUNCTION    InitProcMenu
  434.     ENDIF
  435.  
  436. ;
  437. ; pascal void GetItemCmd(MenuRef theMenu, short item, asciichar *cmdChar)
  438. ;
  439.     IF ¬ GENERATINGCFM THEN
  440.         _GetItemCmd:    OPWORD    $A84E
  441.     ELSE
  442.         IMPORT_CFM_FUNCTION    GetItemCmd
  443.     ENDIF
  444.  
  445. ;
  446. ; pascal void SetItemCmd(MenuRef theMenu, short item, asciichar cmdChar)
  447. ;
  448.     IF ¬ GENERATINGCFM THEN
  449.         _SetItemCmd:    OPWORD    $A84F
  450.     ELSE
  451.         IMPORT_CFM_FUNCTION    SetItemCmd
  452.     ENDIF
  453.  
  454. ;
  455. ; pascal long PopUpMenuSelect(MenuRef menu, short top, short left, short popUpItem)
  456. ;
  457.     IF ¬ GENERATINGCFM THEN
  458.         _PopUpMenuSelect:    OPWORD    $A80B
  459.     ELSE
  460.         IMPORT_CFM_FUNCTION    PopUpMenuSelect
  461.     ENDIF
  462.  
  463. ;
  464. ; pascal long MenuChoice(void)
  465. ;
  466.     IF ¬ GENERATINGCFM THEN
  467.         _MenuChoice:    OPWORD    $AA66
  468.     ELSE
  469.         IMPORT_CFM_FUNCTION    MenuChoice
  470.     ENDIF
  471.  
  472. ;
  473. ; pascal void DeleteMCEntries(short menuID, short menuItem)
  474. ;
  475.     IF ¬ GENERATINGCFM THEN
  476.         _DeleteMCEntries:    OPWORD    $AA60
  477.     ELSE
  478.         IMPORT_CFM_FUNCTION    DeleteMCEntries
  479.     ENDIF
  480.  
  481. ;
  482. ; pascal MCTableHandle GetMCInfo(void)
  483. ;
  484.     IF ¬ GENERATINGCFM THEN
  485.         _GetMCInfo:    OPWORD    $AA61
  486.     ELSE
  487.         IMPORT_CFM_FUNCTION    GetMCInfo
  488.     ENDIF
  489.  
  490. ;
  491. ; pascal void SetMCInfo(MCTableHandle menuCTbl)
  492. ;
  493.     IF ¬ GENERATINGCFM THEN
  494.         _SetMCInfo:    OPWORD    $AA62
  495.     ELSE
  496.         IMPORT_CFM_FUNCTION    SetMCInfo
  497.     ENDIF
  498.  
  499. ;
  500. ; pascal void DisposeMCInfo(MCTableHandle menuCTbl)
  501. ;
  502.     IF ¬ GENERATINGCFM THEN
  503.         _DisposeMCInfo:    OPWORD    $AA63
  504.     ELSE
  505.         IMPORT_CFM_FUNCTION    DisposeMCInfo
  506.     ENDIF
  507.  
  508. ;
  509. ; pascal MCEntryPtr GetMCEntry(short menuID, short menuItem)
  510. ;
  511.     IF ¬ GENERATINGCFM THEN
  512.         _GetMCEntry:    OPWORD    $AA64
  513.     ELSE
  514.         IMPORT_CFM_FUNCTION    GetMCEntry
  515.     ENDIF
  516.  
  517. ;
  518. ; pascal void SetMCEntries(short numEntries, MCTablePtr menuCEntries)
  519. ;
  520.     IF ¬ GENERATINGCFM THEN
  521.         _SetMCEntries:    OPWORD    $AA65
  522.     ELSE
  523.         IMPORT_CFM_FUNCTION    SetMCEntries
  524.     ENDIF
  525.  
  526. ;
  527. ; pascal void InsertFontResMenu(MenuRef theMenu, short afterItem, short scriptFilter)
  528. ;
  529.     IF ¬ GENERATINGCFM THEN
  530.         Macro
  531.         _InsertFontResMenu
  532.             move.w    #$0400,d0
  533.             dc.w     $A825
  534.         EndM
  535.     ELSE
  536.         IMPORT_CFM_FUNCTION    InsertFontResMenu
  537.     ENDIF
  538.  
  539. ;
  540. ; pascal void InsertIntlResMenu(MenuRef theMenu, ResType theType, short afterItem, short scriptFilter)
  541. ;
  542.     IF ¬ GENERATINGCFM THEN
  543.         Macro
  544.         _InsertIntlResMenu
  545.             move.w    #$0601,d0
  546.             dc.w     $A825
  547.         EndM
  548.     ELSE
  549.         IMPORT_CFM_FUNCTION    InsertIntlResMenu
  550.     ENDIF
  551.  
  552. ;
  553. ; pascal Boolean SystemEdit(short editCmd)
  554. ;
  555.     IF ¬ GENERATINGCFM THEN
  556.         _SystemEdit:    OPWORD    $A9C2
  557.     ELSE
  558.         IMPORT_CFM_FUNCTION    SystemEdit
  559.     ENDIF
  560.  
  561. ;
  562. ; pascal void SystemMenu(long menuResult)
  563. ;
  564.     IF ¬ GENERATINGCFM THEN
  565.         _SystemMenu:    OPWORD    $A9B5
  566.     ELSE
  567.         IMPORT_CFM_FUNCTION    SystemMenu
  568.     ENDIF
  569.  
  570.     IF OLDROUTINENAMES  THEN
  571.     ENDIF
  572.     ENDIF ; __MENUS__
  573.